package com.scau.service.impl;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import com.scau.dao.IEmployeeDao;
import com.scau.service.IEmployeeService;
import com.scau.util.DateTransform;
import com.scau.vo.Employee;

/**
 * @author Jinglun
 * @create 2017年4月20日
 */
public class EmployeeServiceImpl implements IEmployeeService {

	private IEmployeeDao employeeDao;
	
	@Override
	public boolean saveEmployee(Employee employee) {
		Date date = new Date();
		DateTransform dt = new DateTransform();
		Timestamp create = dt.dToTimestamp(date);
		employee.setGmtCreate(create);
		return employeeDao.saveEmployee(employee);
	}

	@Override
	public boolean deleteEmployee(int id) {
		return employeeDao.deleteEmployee(id);
	}

	@Override
	public boolean updateEmployee(Employee employee) {
		Date date = new Date();
		DateTransform dt = new DateTransform();
		Timestamp modified = dt.dToTimestamp(date);
		employee.setGmtModified(modified);
		return employeeDao.updateEmployee(employee);
	}

	@Override
	public List<Employee> listEmployee() {
		return employeeDao.listEmployee();
	}

	// get,set methods
	public IEmployeeDao getEmployeeDao() {
		return employeeDao;
	}

	public void setEmployeeDao(IEmployeeDao employeeDao) {
		this.employeeDao = employeeDao;
	}

	
}
